package com.fitbet.admin.dto;

import java.beans.Transient;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import javax.persistence.EnumType;
import javax.persistence.Enumerated;

import com.fitbet.entity.bet.Bet;
import com.fitbet.entity.bet.BetStatus;

public class BetRequest {

	
	
	/**
     * 赌局名称
     */
    private String name;

    /**
     * 开始时间呢
     */
  
    private String startDate;

    /**
     * 结束时间
     */
   
    private String endDate;

    /**
     * 状态
     */
    @Enumerated(EnumType.ORDINAL)
    private BetStatus status;

    /**
     * 奖金池
     */
    private int bonus;
    
    /**
     * 参与人数
     */
    private int thumbAmount;
    
    
    private String mediaId;
    
    
	public BetRequest() {
		
	}

	/**
	 * 
	 * @return
	 * @throws ParseException 
	 */
	@Transient
	public Bet generateBet() throws ParseException {
		
		SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
    	java.util.Date startDate=sdf.parse(this.startDate);
    	Date endDate = sdf.parse(this.endDate);
		Bet bet = new Bet();
		bet.setName(this.name);
		bet.setBonus(this.bonus);
		bet.setStartDate(startDate);
		bet.setEndDate(endDate);
		bet.setThumbAmount(this.thumbAmount);
		bet.setStatus(BetStatus.CREATED);
		bet.setAvatar(this.mediaId);
		return bet;
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @return the startDate
	 */
	public String getStartDate() {
		return startDate;
	}

	/**
	 * @return the endDate
	 */
	public String getEndDate() {
		return endDate;
	}

	/**
	 * @return the status
	 */
	public BetStatus getStatus() {
		return status;
	}

	/**
	 * @return the bonus
	 */
	public int getBonus() {
		return bonus;
	}

	/**
	 * @return the thumbAmount
	 */
	public int getThumbAmount() {
		return thumbAmount;
	}

	/**
	 * @return the mediaId
	 */
	public String getMediaId() {
		return mediaId;
	}

	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @param startDate the startDate to set
	 */
	public void setStartDate(String startDate) {
		this.startDate = startDate;
	}

	/**
	 * @param endDate the endDate to set
	 */
	public void setEndDate(String endDate) {
		this.endDate = endDate;
	}

	/**
	 * @param status the status to set
	 */
	public void setStatus(BetStatus status) {
		this.status = status;
	}

	/**
	 * @param bonus the bonus to set
	 */
	public void setBonus(int bonus) {
		this.bonus = bonus;
	}

	/**
	 * @param thumbAmount the thumbAmount to set
	 */
	public void setThumbAmount(int thumbAmount) {
		this.thumbAmount = thumbAmount;
	}

	/**
	 * @param mediaId the mediaId to set
	 */
	public void setMediaId(String mediaId) {
		this.mediaId = mediaId;
	}
    
}
